/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"BE9B0376-B429-4661-85CF-9893D3EC9D56",variableType:8}
 */
var fTotal2 = 0;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"DB2785F6-EE24-4E1D-A759-F5D551DEC891",variableType:8}
 */
var fTotal = 0;

/**
 * Handle changed data.
 *
 * @param {Number} oldValue old value
 * @param {Number} newValue new value
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"CE271C7A-8571-44F0-A775-0388E3789491"}
 */
function cambiaTotal(oldValue, newValue, event) {
	fTotal = fTotal - oldValue + newValue
	return true
}

/**
 * Handle changed data.
 *
 * @param {Number} oldValue old value
 * @param {Number} newValue new value
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"1271DFB2-EFC8-4AC4-ACD5-6F81D7E1163A"}
 */
function cambiaTotal2(oldValue, newValue, event) {
	fTotal2 = fTotal2 - oldValue + newValue
	return true
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"24965C15-A9DF-4C9D-90D3-392D24CD0960"}
 */
function cancelar(event) {
	databaseManager.revertEditedRecords()
	databaseManager.setAutoSave(true)
	var $win = application.getWindow('ALTA_ENCARGADO_SUELDO')
	$win.hide()
	$win.destroy()
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"A067FB9E-52E0-4E9C-8C72-AA526D971C2F"}
 */
function aceptar(event) {
	if (databaseManager.saveData())
	{
		databaseManager.setAutoSave(true)
		var $win = application.getWindow('ALTA_ENCARGADO_SUELDO')
		$win.hide()
		$win.destroy()
	}
	else
	{
		globals.DIALOGS.showErrorDialog('Error','Ocurrio un error','OK')
	}
}

/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"780C40A9-7D94-4171-9B3E-16FE34261D32"}
 */
function onShow(firstShow, event) {
	elements.fld_consorcio.requestFocus()
}
